"use client";
import Link from "next/link";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import React, { useCallback } from "react";

const Navigation = () => {
  const pathname = usePathname();
  const query = useSearchParams();
  console.log(query.get("name"));
  const router = useRouter();
  const onClick = useCallback(() => {
    router.push("/");
  }, [router]);
  return (
    <div>
      <Link href="/" prefetch={false}>
        Home
      </Link>

      <button onClick={onClick}>write and redirect</button>
    </div>
  );
};

export default Navigation;
